Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

Fix: resolve intermittent system-test timeouts in common.ts#2721

Merged
thiyaguk09 merged 1 commit into
googleapis:fix/system-test-flake-commonfrom
thiyaguk09:fix/system-test-flake-common
Feb 6, 2026
Merged

Fix: resolve intermittent system-test timeouts in common.ts#2721
thiyaguk09 merged 1 commit into
googleapis:fix/system-test-flake-commonfrom
thiyaguk09:fix/system-test-flake-common

Conversation

@thiyaguk09
Copy link
Copy Markdown
Contributor

Description

This PR resolves intermittent flakiness and timeouts in the Service system tests within common.ts.

Key Changes:

  • Dynamic Ports: Refactored mock servers to use port 0 (ephemeral ports) instead of hardcoded 8118 to prevent EADDRINUSE collisions in CI runners.
  • Retry Logic: Increased the test timeout to 90s to accommodate exponential backoff delays and CI environment latency.
  • Lifecycle Management: Wrapped assertions in try/catch to ensure mockServer.close() is always called, preventing socket leaks.
  • Async Fix: Corrected a race condition in the non-responsive host test where done() was being called before the retry cycle completed.

Impact

Reduces "Exit Status 1" build failures in Kokoro CI, improving the stability of the continuous integration pipeline for the Node.js Storage library.

Testing

  • System Tests: Verified locally via npm run system-test.
  • Telemetry: Inspected retry cycles using NODE_DEBUG=http to confirm the library correctly registers all 4 attempts before concluding.
  • Cleanup: Confirmed no orphaned processes or open sockets remain after test completion.

Additional Information

The original 60s timeout was frequently exceeded during the 4-attempt retry cycle when the CI runner was under heavy load. The move to dynamic ports is the primary structural fix to prevent cross-test interference.

Checklist

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease
  • Appropriate docs were updated
  • Appropriate comments were added, particularly in complex areas or places that require background
  • No new warnings or issues will be generated from this change

Fixes #issue_number_goes_here 🦕

- Implement dynamic port allocation (port 0) for mock servers to avoid
EADDRINUSE collisions in CI.
- Increase timeout to 90s for retry logic to accommodate environmental
latency.
- Ensure mock servers are explicitly closed in both success and failure
blocks.
- Fix async race condition in 'non-responsive hosts' test by moving
done() into the callback.
@thiyaguk09 thiyaguk09 requested review from a team February 6, 2026 12:00
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/nodejs-storage API. labels Feb 6, 2026
@thiyaguk09 thiyaguk09 marked this pull request as draft February 6, 2026 12:00
@thiyaguk09 thiyaguk09 changed the base branch from main to fix/system-test-flake-common February 6, 2026 12:02
@thiyaguk09 thiyaguk09 merged commit 39161fa into googleapis:fix/system-test-flake-common Feb 6, 2026
13 of 14 checks passed
@thiyaguk09
Copy link
Copy Markdown
Contributor Author

This was created from the fork branch by mistake. Please disregard.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storage Issues related to the googleapis/nodejs-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant